import { DatePicker } from "antd";
import React, { useState } from "react";
import { format } from "date-fns"; 
import Counter from "../../components/Counter";
import PostsList from "../../components/PostsList";
function Home() {
  const [time, setTime] = useState(null);
  const onChangeTime = (date, dateString) => {
    console.log(date, dateString, time);
    setTime(date);
  };
  return (
    <div style={{height:1110}}>
      首页
       {time && <p>选中的日期：{format(time, "yyyy-MM-dd")}</p>}
      <DatePicker value={time} onChange={onChangeTime}></DatePicker>
      <br></br>
      <Counter></Counter>
      <PostsList></PostsList>
    </div>
  );
}

// 关键：必须有默认导出
export default Home;
